﻿namespace SharpF2.Model
{
	using System;
	using System.Collections.Generic;
	using System.IO;
	using System.Windows;
	using ModelView;

	/// <summary>
	/// Defines the UndoLogFileItem type.
	/// </summary>
	public class UndoLogFileItem
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the <see cref="UndoLogFileItem" /> class. 
		/// </summary>
		/// <param name="logFilePath">Log file path</param>
		public UndoLogFileItem(string logFilePath)
		{
			LogFilePath = logFilePath;
			LogFileName = Path.GetFileName(logFilePath);
			try
			{
				var fileInfo = new FileInfo(LogFilePath);
				RenamedFiles = UndoManagerLogExtractor.GetUndoFileItem(fileInfo);
			}
			catch (Exception e)
			{
				MessageBox.Show(e.Message);
			}
		}

		#endregion

		#region Public Properties

		/// <summary>
		/// Gets LogFileName.
		/// </summary>
		public string LogFileName { get; private set; }

		/// <summary>
		/// Gets LogFilePath.
		/// </summary>
		public string LogFilePath { get; private set; }

		/// <summary>
		/// Gets RenamedFiles.
		/// </summary>
		public List<UndoFileItem> RenamedFiles { get; private set; }

		#endregion
	}
}